$(function() {
	admin.report.init();
});
Namespace('admin.report',{
	init:function() {
		easyui.util.initDatagrid('#datagrid',{
			onDblClickRow:function() {
			}
		});
	},
	query:function() {
		if(!$('#query-form').form('validate')) return;
		var data=$('#query-form').form('jsonObject');
		$('#datagrid').datagrid('load',data);
	},
	detail:function(id) {
		if (id != null) {
			top.addTab(id,'详情', contextPath+'/pub/report/detail?id=' + id);
		}
	},
	setIsShow: function (reportId, bussId,bussType,isShow) {
		var tip = "确定屏蔽吗";
		if (isShow) {
			tip = "确定解除屏蔽吗";
		}
		$.messager.confirm('信息提示', tip, function (success) {
			if (!success) {
				return;
			}

            var url = contextPath + '/pub/report/showReport';
			if (!isShow) {
				url = contextPath + '/pub/report/hideReport';
			}
			$('#datagrid').datagrid('loading');
			$.post(url, {'reportId': reportId,'bussId':bussId,'bussType':bussType}, function (result) {
				$('#datagrid').datagrid('loaded');
				if (result.code == 1) {
					top.showInfo('操作成功');
					var pageopt = $('#datagrid').datagrid('getPager').data("pagination").options;
					console.log(pageopt.pageNumber);
                    admin.report.query();
				} else {
					top.showInfo(result.msg);
				}
			});

		});
	}
});